<template>
	<section id="index">
		<HeaDer :Title='titleData'></HeaDer>
		<nav class="nav_warp">
			<span>{{$t("message.index.bizhong")}}</span>
			<span>{{$t("message.index.jiage")}}</span>
			<span>{{$t("message.index.zhangdiefu")}}</span>
		</nav>
		<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
			<!--数据-->
			<Datalist :method="method" ref='offInt'></Datalist>
		</van-pull-refresh>
		<FooTer :Active="activeKey"></FooTer>

	</section>
</template>
<script>
	import Header from "./common/header.vue";
	import Footer from "./common/footer.vue";
	import Datalist from "./common/dataList.vue";
	export default {
		// 数据
		data() {
			return {
				activeKey: 0,
				isLoading: false, //下拉刷新
				titleData: { //向主件header要传的值  其中 name是名字  flat控制有没有返回箭头
					name: '行情',
					flat: 0
				}
			};
		},
		// 当数据发生改变时
		watch: {},
		// 方法
		methods: {
			//webSocket 推送
			onRefresh() {
				var _this = this;
				setTimeout(() => {
					this.$toast('刷新成功');
					this.isLoading = false;
				}, 500);
			},
			//控制子主件函数
			method(v, n) {
				this.$router.push({
					path: '/kline',
					query: {
						id: v
					}
				});
			},

		},
		// 路由发生变化时
		beforeRouteLeave(to, from, next) {
			//干掉推送
			this.$refs.offInt.offTime();
			next()
		},
		// 加载模块
		components: {
			"HeaDer": Header,
			"FooTer": Footer,
			'Datalist': Datalist
		},
		// 加载执行
		created: function() {

		}
	};
</script>

<style>

</style>